﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ParkingApp.Lib;
using ParkingApp.ParkingSlot.Simulator.Lib;
using TechTalk.SpecFlow;
using FluentAssertions;
using System.Diagnostics;

namespace ParkingApp.Specs
{
    [Binding]
    public class ParkingTicketStep
    {
        Slot _slot = null;
        string _plateNumber = null;
        TicketDetail _ticket = null;

        [Given(@"There is available parking slot")]
        public void GivenThereIsAvailableParkingSlot()
        {
            _slot = new Parking().GetAvailableSlot();
            _slot.Should().NotBeNull();
        }

        [Given(@"My plate number can be listed")]
        public void GivenMyPlateNumberCanBeListed()
        {
            _plateNumber = "ABC123";
        }

        [When(@"I press Get Ticket")]
        public void WhenIPressGetTicket()
        {
            _ticket = new Parking().AllocateParkingSlot(_slot, _plateNumber);
        }

        [Then(@"the result should be ""(.*)""")]
        public void ThenTheResultShouldBe(string p0)
        {
            _ticket.Should().NotBeNull();
        }

        [Given(@"There is no available parking slot")]
        public void GivenThereIsNoAvailableParkingSlot()
        {
            _slot = null;
        }

        [Then(@"the result should be no ticket generated")]
        public void ThenTheResultShouldBeNoTicketGenerated()
        {
            _ticket.Should().BeNull();
        }
    }
}
